package com.wetool.wechat.feign;

import com.wetool.common.auth.modle.AccountDto;
import com.wetool.common.model.Message;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 认证服务Feign客户端接口
 */
@FeignClient("auth-server")
public interface AuthFeignClient {

    /**
     * 验证微信用户
     * 调用认证服务的用户信息查询接口，查询用户角色是否匹配
     *
     * @param userId
     * @param role
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/users/{userId}/info")
    ResponseEntity<Message<?>> verifyUser(@PathVariable("userId") long userId, @RequestParam("role") String role);

    /**
     * 用户注册接口
     *
     * @param accountDto
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/users/register")
    ResponseEntity<Message<?>> signUpUser(AccountDto accountDto);

}

